import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

interface I {
	void get();
}

class A implements I {
	private int x;
	private int y;
	
	public A(int a, int b) {
		this.x=a;
		this.y=b;
		System.out.println("Object is created with params: " +a+", "+b);
	}
	
	public void get() {
		System.out.println("x="+this.x+"; y="+this.y);
	}
	
}

public class HelloWorld {
	public static void main(String args[]) throws SecurityException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
		List<I> list = new ArrayList<I>();
		String className = "A";

		Constructor<?> c = Class.forName(className).getConstructor(int.class, int.class);
		
		Constructor c2 = Class.forName(className).getConstructors()[0];
		
		list.add((I) c2.newInstance(1,5));
		

		for (I i: list) i.get();

	}
}